Skip to content

Add specs for half option in Rational#round - #493

Merged
eregon merged 2 commits into
ruby:masterfrom
tegon:rational-round-specs
Oct 12, 2017
Merged

eregon merged 2 commits into
ruby:masterfrom
tegon:rational-round-specs

Conversation

@tegon

@tegon tegon commented Oct 11, 2017 •

Copy link
Copy Markdown
Contributor

In Ruby 2.4 the round method in Rational accepts a keyword argument
(half).
The specs values were based on rational.c and float/round_spec.rb

See more on issue: #473

Comment thread shared/rational/round.rb Outdated
Rational(-10, 4).round(half: :even).should == -2
end

it "returns a Rational" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns a Rational when the precision is greater than 0

Comment thread shared/rational/round.rb Outdated

ruby_version_is "2.4" do
describe "with half option" do
it "returns an Integer" do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns an Integer when precision is not passed

@eregon

eregon commented Oct 12, 2017

Copy link
Copy Markdown
Member

Looks good, the descriptions just need to be improved a bit :)

@tegon

tegon commented Oct 12, 2017

Copy link
Copy Markdown
Contributor Author

@eregon Sure thing, I've updated the description.
Thanks for your comments!

@eregon
eregon merged commit 770b3bf into ruby:master Oct 12, 2017
@eregon

eregon commented Oct 12, 2017

Copy link
Copy Markdown
Member

@tegon Thank you for your contribution, merged!

@tegon
tegon deleted the rational-round-specs branch December 27, 2018 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants